import wtforms

from packages.common.base import BaseForm, BasePageForm


class {{table.tableHumpName}}Form(BaseForm):
    """
    {{table.comment}}表单校验类
    """
    id = wtforms.IntegerField(){% for column in table.columns %}{%if column.name not in ['id','create_time','update_time','is_deleted']%}{% if not (table.treeTable and column.name in ['parent_id', 'name', 'sort']) %}
    {{column.camelName}} = wtforms.StringField("{{column.comment}}"{%if not column.nullable or (table.treeTable and column.name == 'name')%}, [wtforms.validators.DataRequired(message="{{column.comment}}不能为空")]{%endif%}){% endif %}{%if table.treeTable and column.name == 'parent_id' %}
    parentId = wtforms.StringField("父ID"){% elif table.treeTable and column.name == 'name' %}
    name = wtforms.StringField("名称", [wtforms.validators.DataRequired(message="名称不能为空")]){% elif table.treeTable and column.name == 'sort' %}
    sort = wtforms.StringField("排序"){% endif %}{%endif%}{% endfor %}


class {{table.tableHumpName}}PageForm(BasePageForm):
    """
    {{table.comment}}分页校验类
    """
    pass

